/*
   @Copyright:LeetCode
   @Author:   tjyemail
   @Problem:  http://leetcode.com/problems/remove-duplicates-from-sorted-array
   @Language: C++
   @Datetime: 19-05-30 17:15
   */

class Solution {
public:
	int removeDuplicates(vector<int>& nums) {
		if(nums.size()==0) return 0;
		int len=1;
		for(int i=1; i<nums.size(); ++i)
			if(nums[i-1]!=nums[i]) nums[len++]=nums[i];
		return len;
	}
};
